<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div>
    <el-form ref="form" :model="s_tech_process" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 工艺工序 </span>
      </div>
      <el-table :data="s_tech_process">
        <el-table-column label="" prop="process_id" width="80">
          <template slot-scope="scope">
            <el-button @click="$parent.$parent.closeSetProcedureMaterial(scope.row['process_id'],scope.row['process_name']);" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
          </template>
        </el-table-column>
        <el-table-column label="工序名称" prop="process_name">
        </el-table-column>
        <el-table-column label="工序编号" prop="process_num">
        </el-table-column>
        <el-table-column label="变更状态" prop="process_state">
        </el-table-column>
        <el-table-column label="工序描述" prop="process_des">
        </el-table-column>
        <el-table-column label="工序管理员" prop="process_user">
        </el-table-column>
      </el-table>
      <el-button @click="popProcedureChoice('')" type='primary' size="mini">选择工序</el-button>
    </el-form>
    <el-dialog :visible.sync="ProcedureChoiceVisible" append-to-body>
      <ProcedureChoice v-if="ProcedureChoiceVisible" ref="ProcedureChoice" :popparams="popparams"> </ProcedureChoice>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProcedureChoice from "@/views/mes/product/ProcedureChoice";
  export default {
    name: 'SetProcedureMaterial',
    components: {
      ProcedureChoice,
    },
    props: ['popparams'],
    data() {
      return {
        ProcedureChoiceVisible: false,
        ProcedureChoiceValue: null,
        ProcedureChoiceDesc: null,
        vueparams: this.getVUEParams(""),
        s_tech_process: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/product/TechnologyAction/setProcedureMaterial?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popProcedureChoice(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ProcedureChoiceVisible = !this.ProcedureChoiceVisible;
      },
    },
  }
</script>
